<?php

/**
 * @author vladone
 * @copyright 2007
 */

include ('include/conf.php');
no_cache();
//begin verificare data
$id_connect = connect_to_database(HOST, USER, PASS, DATABASE);
echo time()."<br>";
/*
$comun = "SET cost='12' WHERE companie='Movistar-Spain' AND marca='Siemens' AND model='EL71'";
$str = "UPDATE credit ".$comun;
mysql_query($str,$id_connect);
$affected = mysql_affected_rows($id_connect);
echo "faza I: ".$affected."<br>";
echo mysql_error();

$str = "UPDATE credit_clienti ".$comun;
mysql_query($str,$id_connect);
$affected = mysql_affected_rows($id_connect);
echo "faza II: ".$affected."<br>";
echo mysql_error();
*/
/*
//delete
$common = "WHERE marca='Nokia' AND model='6151' AND companie='Yoigo-Spain'";
$str = "DELETE FROM credit ".$common;
mysql_query($str,$id_connect);
echo mysql_error();
$affected = mysql_affected_rows($id_connect);
echo "delete I: ".$affected."<br>";

$str = "DELETE FROM credit_clienti ".$common;
mysql_query($str,$id_connect);
echo mysql_error();
$affected = mysql_affected_rows($id_connect);
echo "delete II: ".$affected."<br>";
*/
/*
$str = "SELECT * FROM credit ORDER BY marca ASC";
$result = mysql_query($str,$id_connect);
while ($value = mysql_fetch_assoc($result)) {
	$marca = $value['marca'];
	$model = $value['model'];
	$companie = $value['companie'];
	$cost = $value['cost'];
	$str2 = "UPDATE credit_clienti SET cost='$cost' WHERE marca='$marca' AND model='$model' AND companie='$companie'";
	mysql_query($str2,$id_connect);
	$affected = mysql_affected_rows($id_connect);
	echo $marca." ".$model." ".$companie." afected records:".$affected."<br>";	
}
*/
/*
$str = "SELECT mail from clienti ORDER by mail ASC";
$result = mysql_query($str,$id_connect);
while ($value = mysql_fetch_assoc($result)) {
	if($value['mail']!="")
	echo $value['mail'].",";
}
*/
$str = "SELECT * FROM credit ORDER BY marca ASC";
$result = mysql_query($str,$id_connect);
while ($value = mysql_fetch_assoc($result)) {
	$marca = $value['marca'];
	$model = $value['model'];
	$companie = $value['companie'];
	$cost = $value['cost'];
	echo "marca: $marca"." model: $model"." companie: $companie"." cost: $cost<br>";	
}
echo "finish!";

?>